package com.qws.plugin.presentation.flutter_presentation.ui

import android.content.Context
import android.view.ViewGroup
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.QuickViewHolder
import com.qws.plugin.presentation.flutter_presentation.R
import com.qws.plugin.presentation.flutter_presentation.model.CustomModel
import com.qws.plugin.presentation.flutter_presentation.model.Product

class ProductAdapter: BaseQuickAdapter<Product, QuickViewHolder>() {
    override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): QuickViewHolder {
        // 返回一个 ViewHolder
        return QuickViewHolder(R.layout.item_product, parent)
    }

    override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: Product?) {
        // 设置item数据
        item?.let {
            holder.setText(R.id.tv_name, it.name)
                .setText(R.id.tv_count, it.count.toString())
                .setText(R.id.tv_price, it.price)
        }

    }

}